#ifndef _CLOCK_H_
#define _CLOCK_H_

#include "sc95f_timer0.h"
#include "sc95f_timer1.h"
#include "sc95f_timer2.h"
#include "sc95f_timer3.h"
#include "sc95f_timer4.h"
#include "ClockConfig.h"

#define CLOCK_TIMER0 0
#define CLOCK_TIMER1 1
#define CLOCK_TIMER2 2
#define CLOCK_TIMER3 3
#define CLOCK_TIMER4 4

#if (CLOCK_TIMER == CLOCK_TIMER0)
#endif

#define PRESSEL_FSYS_D12 0x00 /* TIMx_PRESSEL_FSYS_D12 = 0 */
#define PRESSEL_FSYS_D1 0x01  /* TIMx_PRESSEL_FSYS_D1 = 0x01 */

#define CLOCK_WorkMode0 0 /* TIMx_WORK_MODE0 = 0 */
#define CLOCK_WorkMode1 1 /* TIMx_WORK_MODE1 = 1 */
#define CLOCK_WorkMode2 2 /* TIMx_WORK_MODE2 = 2 */
#define CLOCK_WorkMode3 3 /* TIMx_WORK_MODE3 = 3 */

#define CLOCK_MODE_TIMER 0x01 /* TIM4_MODE_TIMER = 0x01 */

#if (CLOCK_WorkMode == CLOCK_WorkMode0)
#define CLOCK_TIM0_WorkModeConfig TIM0_WorkMode0Config
#define CLOCK_TIM0_ModeSetReloadCounter TIM0_Mode0SetReloadCounter
#define CLOCK_TIM1_WorkModeConfig TIM1_WorkMode0Config
#define CLOCK_TIM1_ModeSetReloadCounter TIM1_Mode0SetReloadCounter
#define CLOCK_TIM2_WorkModeConfig TIM2_WorkMode0Config
#define CLOCK_TIM2_ModeSetReloadCounter TIM2_WorkMode0Config
#define CLOCK_TIM3_WorkModeConfig TIM3_WorkMode0Config
#define CLOCK_TIM3_ModeSetReloadCounter TIM3_WorkMode0Config
#define CLOCK_TIM4_WorkModeConfig TIM4_WorkMode0Config
#define CLOCK_TIM4_ModeSetReloadCounter TIM4_WorkMode0Config
#elif (CLOCK_WorkMode == CLOCK_WorkMode1)
#define CLOCK_TIM0_WorkModeConfig TIM0_WorkMode1Config
#define CLOCK_TIM0_ModeSetReloadCounter TIM0_Mode1SetReloadCounter
#define CLOCK_TIM1_WorkModeConfig TIM1_WorkMode1Config
#define CLOCK_TIM1_ModeSetReloadCounter TIM1_Mode1SetReloadCounter
#define CLOCK_TIM2_WorkModeConfig TIM2_WorkMode1Config
#define CLOCK_TIM2_ModeSetReloadCounter TIM2_WorkMode1Config
#define CLOCK_TIM3_WorkModeConfig TIM3_WorkMode1Config
#define CLOCK_TIM3_ModeSetReloadCounter TIM3_WorkMode1Config
#define CLOCK_TIM4_WorkModeConfig TIM4_WorkMode1Config
#define CLOCK_TIM4_ModeSetReloadCounter TIM4_WorkMode1Config
#endif

void Clock_init();
uint32_t Clock_mills();

#endif
